import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ViewAppointmentVO, ViewAppointmentForm, ViewAppointmentQuery } from '@/api/apartment/viewAppointment/types';

/**
 * 查询预约看房信息列表
 * @param query
 * @returns {*}
 */

export const listViewAppointment = (query?: ViewAppointmentQuery): AxiosPromise<ViewAppointmentVO[]> => {
  return request({
    url: '/apartment/viewAppointment/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询预约看房信息详细
 * @param id
 */
export const getViewAppointment = (id: string | number): AxiosPromise<ViewAppointmentVO> => {
  return request({
    url: '/apartment/viewAppointment/' + id,
    method: 'get'
  });
};

/**
 * 新增预约看房信息
 * @param data
 */
export const addViewAppointment = (data: ViewAppointmentForm) => {
  return request({
    url: '/apartment/viewAppointment',
    method: 'post',
    data: data
  });
};

/**
 * 修改预约看房信息
 * @param data
 */
export const updateViewAppointment = (data: ViewAppointmentForm) => {
  return request({
    url: '/apartment/viewAppointment',
    method: 'put',
    data: data
  });
};

/**
 * 删除预约看房信息
 * @param id
 */
export const delViewAppointment = (id: string | number | Array<string | number>) => {
  return request({
    url: '/apartment/viewAppointment/' + id,
    method: 'delete'
  });
};
